package com.example.demo.vo

import com.example.demo.dbmodels.THospital
import java.math.BigDecimal
import java.time.LocalDateTime

class  HospitalVo{

    /**
     *  ID
     **/
    var id: Int? = null
    /**
     *  名称
     **/
    var name: String? = null
    /**
     *  简介
     **/
    var intro: String? = null
    /**
     *  许可证
     **/
    var license: String? = null
    /**
     *  官网url
     **/
    var logo_url: String? = null
    /**
     *  地址
     **/
    var address: String? = null
    /**
     *  邮政编码
     **/
    var post_code: String? = null
    /**
     *  电话
     **/
    var phone: String? = null
    /**
     *  邮件
     **/
    var email: String? = null
    /**
     *  图片地址
     **/
    var image_url: String? = null
    /**
     *  区域名称
     **/
    var area_name: String? = null
    /**
     *  负责人
     **/
    var master_name: String? = null
    /**
     *  负责人电话
     **/
    var master_mobile: String? = null
    /**
     *  经度
     **/
    var longitude: BigDecimal?= null
    /**
     *  latitude
     **/
    var latitude: BigDecimal?= null
    /**
     *  组织类型
     **/
    var org_type: Int?= null
    /**
     *  等级
     **/
    var level: Int?= null
    /**
     *  显示网页
     **/
    var is_show_web: Int?= null
    /**
     *  备注
     **/
    var remark: String? = null
    /**
     *  更新人
     **/
    var update_by: Int?= null
    /**
     *  更新时间
     **/
    var update_time: LocalDateTime?= null



    fun getHospitalVo(table: THospital) : HospitalVo{
        table?.let {
           val data =  HospitalVo()
            data.address = it.address
            data.area_name = it.area_name
            data.email = it.email
            data.id = it.id
            data.image_url = it.image_url
            data.intro = it.intro
            data.is_show_web = it.is_show_web
            data.latitude = it.latitude
            data.level = it.level
            data.license = it.license
            data.logo_url = it.logo_url
            data.longitude = it.longitude
            data.master_mobile = it.master_mobile
            data.master_name = it.master_name
            data.name = it.name
            data.org_type = it.org_type
            data.phone = it.phone
            return  data
        }
    }


    fun getHospitalListVo(table: List<THospital> ) :List<HospitalVo> {
       val hospitalList = mutableListOf<HospitalVo>()
        table.forEach {
            val data =  HospitalVo()
            data.address = it.address
            data.area_name = it.area_name
            data.email = it.email
            data.id = it.id
            data.image_url = it.image_url
            data.intro = it.intro
            data.is_show_web = it.is_show_web
            data.latitude = it.latitude
            data.level = it.level
            data.license = it.license
            data.logo_url = it.logo_url
            data.longitude = it.longitude
            data.master_mobile = it.master_mobile
            data.master_name = it.master_name
            data.name = it.name
            data.org_type = it.org_type
            data.phone = it.phone
            hospitalList.add(data)
        }
        return  hospitalList
    }

}